import axios from "../request";

interface GetVerifyCodeDto {
    width: number,
    height: number
}

interface RegisterDto {
    account: string,
    password: string,
    nickname: string,
    captcha: string
}

interface LoginDto {
    account: string,
    password: string,
}

interface getFileDto {
    uuid: string
}

interface updateUser {
    nickname: string;
    signature: string;
}

interface updatePasswordDto {
    newPassword: string;
    confirmPassword: string
}

export default {

    getVerifyCode(params: GetVerifyCodeDto) {
        return axios.get('/auth/getCaptcha', {params: params})
    },
    register(data: RegisterDto) {
        return axios.post('/users/register', data)
    },
    login(data: LoginDto) {
        return axios.post('/auth/login', data)
    },
    getUserInfo() {
        return axios.get('/users/getUserInfo')
    },
    getFile(params: getFileDto) {
        return axios.get('/upload/getFile', {params: params})
    },
    getAccount() {
        return axios.get('/users/getAccount')
    },
    updateUser(data: updateUser) {
        return axios.post('/users/updateUser', data)
    },
    updatePassword(data: updatePasswordDto) {
        return axios.post('/users/passwordUpdate', data)
    }
}